/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 殇
 * Date: 2025-07-10
 * Time: 16:05
 */
class Person{
    public String id;
    public int age;
    public Person(String id,int age) {
        this.id = id;
        this.age=age;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj==null)
            return false;
        if(this==obj)
            return true;
        if(!(obj instanceof Person))
            return false;
        Person p=(Person)obj;
        return this.age==p.age;
    }
}
class Animal{}
public class Test {
    //所有类均可以使用Object引用来接收
    public static void test(){
        Person p1=new Person("123",18);
        Person p2=new Person("123",10);
        System.out.println(p1.equals(p2));

    }
    public static void main(String[] args) {
        test();
    }
}
